package cn.good.biz.service;

import cn.good.pojo.Image;
import cn.good.service.ImageService;
import com.alibaba.dubbo.config.annotation.Reference;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class ImagesServiceImpl implements ImagesService{

    @Reference
    private ImageService imageService;

    @Override
    public void saveImage(String filePath, Integer type, Long id,Long userId) throws Exception {
        Image image = new Image();
        image.setImgUrl(filePath);
        image.setType(type.toString());
        image.setTargetId(id);
        image.setCreatedBy(userId);
        image.setCreationDate(new Date());

        int resoult = imageService.saveImage(image);
        if(resoult<1){
            throw new Exception("失败！");
        }
    }
}
